package com.activenetwork.smlite.page;

import org.apache.commons.lang3.StringUtils;

import com.activenetwork.custom.uielement.UIElement;
import com.activenetwork.custom.uielement.decorate.InJson;
import com.activenetwork.smlite.page.event.EventDetailView.EventBasicSubview;
import com.activenetwork.smlite.page.event.EventDetailView.EventSummarySubview;
import com.activenetwork.smlite.page.generic.PageObject;
import com.activenetwork.util.PageLoader;

public class EventControlGroup implements PageObject {
	
	@InJson
	private UIElement summary;
	@InJson
	private UIElement people;
	@InJson
	private UIElement basic;
	
	public EventSummarySubview showSummary(){
		String value = summary.getAttribute("class");
		if(StringUtils.containsIgnoreCase(value, "hide") ||  StringUtils.containsIgnoreCase(value, "disabled")){
			throw new RuntimeException("Control group summary is either hide or disabled");
		}else{
			summary.click();
		}
		return PageLoader.load(EventSummarySubview.class);
	}
	
	public PageObject showPeople(){
		String value = people.getAttribute("class");
		if(StringUtils.containsIgnoreCase(value, "hide") ||  StringUtils.containsIgnoreCase(value, "disabled")){
			throw new RuntimeException("Control group people is either hide or disabled");
		}else{
			people.click();
		}
		return PageLoader.load(new PageObject(){});
	}
	
	public EventBasicSubview showBasic(){
		String value = basic.getAttribute("class");
		if(StringUtils.containsIgnoreCase(value, "hide") ||  StringUtils.containsIgnoreCase(value, "disabled")){
			throw new RuntimeException("Control group basic is either hide or disabled");
		}else{
			basic.click();
		}
		return PageLoader.load(EventBasicSubview.class);
	}

}
